package com.rongshu.view.home.presenter;

import com.rongshu.api.RetorfitService;
import com.rongshu.view.home.contract.ShareFriendView;
import com.rongshu.view.base.mvp.INetBean;
import com.rongshu.view.home.entity.ShareInformation;

import rx.Subscriber;

public class ShareFriendPresenter {

    private ShareFriendView mView = null;

    public ShareFriendPresenter(ShareFriendView view) {
        this.mView = view;
    }

    /**
     * 文章/帖子分享
     */
    public void getShareInformation(int type, int contribute_id, int type_id,
                                    int user_id, int penpalwill_id, String sign) {
        RetorfitService.getShareInformation(type, contribute_id, type_id,
                user_id, penpalwill_id, sign)
                .subscribe(new Subscriber<ShareInformation>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onNext(ShareInformation information) {
                        if (mView != null) {
                            mView.onShareFriend(information);
                        }
                    }
                });
    }

}
